package com.yuncheng.spcyApi.flow;

import org.apache.commons.lang3.StringUtils;

public class SpcyFlowConstant {

    // 审评查验
    public final static String PROCESS_BUSINESS_YWLX_SPCY = "审评查验";

    /** OA 相关内容 */
    public final static String PROCESS_BUSINESS_YWLX_OA = "OA";
    public final static String OA_XZSWSP_FLOWCODE = "OA_XZSWSP"; // 行政事务审批 编码
    public final static String OA_XZSWSP_SFTGZXLDSH = "否"; // 是否跳过中心领导审核
    public final static String OA_XZSWSP_LB = "其他"; // 行政事务审批-类别
    public final static String OA_FLOW_LCZB = "流程在办"; // 是否跳过中心领导审核
    public final static String OA_FLOW_LCJS = "流程结束"; // 是否跳过中心领导审核
    public final static String OA_FILE_FJ = "oafj"; // OA附件-相对路径minio目录


    // 流程办理按钮类型 - 保存
    public final static String SUBMIT_TYPE_SAVE = "0";

    // 流程办理按钮类型 - 提交
    public final static String SUBMIT_TYPE_SUBMIT = "1";

    /** 流程模版编码 */
    public static final String YPZC_FLOW_CODE_ZWFW = "001001"; // 政务服务-药品注册
    public static final String YPZC_FLOW_CODE_RCJG = "rcjg001001"; // 日常监管-药品注册

    public static final String YPSC_FLOW_CODE_ZWFW  = "001002"; // 政务服务-药品生产
    public static final String YPSC_FLOW_CODE_RCJG = "rcjg001002"; // 日常监管-药品生产

    public static final String YPLT_FLOW_CODE_ZWFW  = "001003"; // 政务服务-药品流通
    public static final String YPLT_FLOW_CODE_RCJG = "rcjg001003"; // 日常监管-药品流通

    public static final String YLQX_FLOW_CODE_ZWFW  = "002"; // 政务服务-医疗器械
    public static final String YLQX_FLOW_CODE_RCJG = "rcjg002"; // 日常监管-医疗器械

    public static final String HZP_FLOW_CODE_ZWFW  = "003"; // 政务服务-化妆品
    public static final String HZP_FLOW_CODE_RCJG = "rcjg003"; // 日常监管-化妆品

    /**
     * 考评
     * 见习考评：个人总结,组长评价,经办人审核
     * 日常考评：经办人审核,科室复核,分管领导审批
     * 年度考评：个人总结,考评审核,考评复核,考评审批
     */
    public static final String KP_YBJCY_FLOW_CODE = "KP-YBJCY-KH"; // 预备检查员（见习考评）
    public static final String KP_RCKH_FLOW_CODE = "KP-RCKH-KH"; // 日常考评
    public static final String KP_RCKHHP_FLOW_CODE = "KP-RCKHHP-KH"; // 日常考评互评
    public static final String KP_NDKH_FLOW_CODE = "KP-NDKH-KH"; // 年度考评



    // 流程环节为空-默认值
    public final static String LCZT_SXLCZB = "流程在办"; // 事项流程状态
    public final static String LCZT_LCBZ = "事项办结"; // 流程状态
    public final static String LCZT_SXGQ = "事项挂起"; // 流程状态

    public final static String LCZT_LCZB = "在办"; // 流程状态-在办
    public final static String LCZT_LCBJ = "办结"; // 流程状态-在办
    public final static String LCZT_LCCX = "撤销"; // 流程状态-撤销

    public final static String JOB_LCSFKB_KB = "可办";
    public final static String JOB_LCSFKB_BKB = "不可办";
    public final static String JOB_LCSFKB_TJB = "提前办";


    /*******************************************[ 审评查验流程-环节名称 ]*******************************/
    // 审评查验流程
    public final static String LCMC_LIKE_SPCYLC = "审评查验流程";

    /** 指定补齐补正环节（无流程配置） */
    public final static String ZDY_HJMC_BQBZ = "补齐补正";
    public final static String ZDY_HJMC_ZGCL = "整改材料";
    public final static String ZDY_HJMC_XCJC = "现场检查";
    public final static String ZDY_HJMC_BQBZ_NODE_ID = "bqbz001";
    public final static String ZDY_HJMC_ZGCL_NODE_ID = "zgcl001";
    public final static String ZDY_HJMC_XCJC_NODE_ID = "xcjc001";
    public final static String ZDY_HJMC_BQBZ_NODE_FSRID = "e9ca23d68d884d4ebb19d07889727dae"; // 管理员

    public final static String HJMC_RWLR = "任务录入";
    public final static String HJMC_RWSL = "任务受理";
    public final static String HJMC_RWFP = "任务分配";
    public final static String HJMC_CLSC = "材料审查";
    public final static String HJMC_CLSCFH = "材料审查复核";
    public final static String HJMC_FAZZ = "方案制定";
    public final static String HJMC_FAFH = "方案复核";
    public final static String HJMC_FASH = "方案审核";
    public final static String HJMC_FASP = "方案审批";
    public final static String HJMC_XCJC = "现场检查";
    public final static String HJMC_ZHPD = "综合评定";
    public final static String HJMC_ZHPD_FH = "综合评定复核";
    public final static String HJMC_KSFH = "科室复核";
    public final static String HJMC_YSQR = "移送确认";

    public final static String HJMC_JSSP = "技术审评";
    public final static String HJMC_SP_FASH = "审评方案审核";
    public final static String HJMC_SP_FASP = "审评方案审批";

    public final static String NODENAME = "任务录入,任务受理,任务分配,材料审查";
    /*******************************************[ 其他流程 ]*******************************/

    /*******************************************[ 审评查验-退回政务相关流程 ]*******************************/

    public static final String THZWFW_001002_FLOW_CODE = "THZWFW-001002";  // 退回政务流程-药品生产
    public final static String THZWFW_LCMC = "退回政务";

    public static final String THZW_HJMC_THZWSH = "退回政务审核";
    public static final String THZW_HJMC_THZWSP = "退回政务审批";
    public final static String THZW_HJMC_END = THZW_HJMC_THZWSP; // 结束结点

    /** 根据业务分类编码-获取对应退回政务的流程模板编码 */
    public static String getThzwfwFlowCodeByYwflcode(String fywflcode){
        if (StringUtils.isBlank(fywflcode)){
            return THZWFW_001002_FLOW_CODE;
        }

        /*if (fywflcode.equals(SpcyConstant.YWFL_CODE_YPSC)){
            return THZWFW_001002_FLOW_CODE;
        }*/

        return THZWFW_001002_FLOW_CODE;
    }

    /*******************************************[ 审评查验-经办人阅知提醒相关流程 ]*******************************/

    public static final String JBRYZTX_001002_FLOW_CODE = "JBRYZTX-001002";  // 经办人阅知提醒流程-药品生产
    public static final String HJMC_JBRYZTX = "经办人阅知提醒";

    /** 根据业务分类编码-获取对应经办人阅知提醒的流程模板编码 */
    public static String getJbryztxFlowCodeByYwflcode(String fywflcode){
        if (StringUtils.isBlank(fywflcode)){
            return JBRYZTX_001002_FLOW_CODE;
        }

        /*if (fywflcode.equals(SpcyConstant.YWFL_CODE_YPSC)){
            return JBRYZTX_001002_FLOW_CODE;
        }*/

        return JBRYZTX_001002_FLOW_CODE;
    }

    /*******************************************[ 审评查验-数据修订相关流程 ]*******************************/

    public final static String SPCY_SJXD_LCMC = "审评数据修订";
    public static final String SPCY_SJXD_FLOW_CODE = "SPCY-SJXD-LC";
    public static final String HJMC_FQSJXD = "填写修订信息";
    public static final String HJMC_SJXDSH = "修订审核";
//    public static final String HJMC_SJXDSP = "修订审批";
    public final static String SPCY_SJXD_HJMC_END = HJMC_SJXDSH; // 结束结点

    /*******************************************[ 审评查验-补齐补正相关流程 ]*******************************/

    public static final String BQBZ_001002_FLOW_CODE = "BQBZLC-001002";  // 经办人阅知提醒流程-药品生产
    public final static String BQBZ_LCMC = "补齐补正";
    public static final String HJMC_BQBZSH = "补齐补正审核";

    /** 根据业务分类编码-获取补齐补正相关流程模板编码 */
    public static String getBqbzFlowCodeByYwflcode(String fywflcode){
        if (StringUtils.isBlank(fywflcode)){
            return BQBZ_001002_FLOW_CODE;
        }

        /*if (fywflcode.equals(SpcyConstant.YWFL_CODE_YPSC)){
            return BQBZ_001002_FLOW_CODE;
        }*/

        return BQBZ_001002_FLOW_CODE;
    }

    /*******************************************[ 审评查验-合并检查相关流程 ]*******************************/

    public static final String SPCY_HBJC_FLOW_CODE = "SPCYHBJC-CODE";  // 经办人阅知提醒流程-药品生产

    /*******************************************[ 预备检查员考评（见习考评） ]*******************************/
    public final static String YBKP_LCMC = "见习考评";

    public final static String YBKP_HJMC_GRZJ = "个人总结";
    public final static String YBKP_HJMC_ZZPJ = "组长评价";
    public final static String YBKP_HJMC_JBRSH = "经办人审核";
//    public final static String YBKP_HJMC_KSFH = "科室复核";

    public final static String YBKP_HJMC_END = YBKP_HJMC_JBRSH; // 结束结点


    /*******************************************[ 日常考评考评 ]*******************************/
    public final static String RCKP_LCMC = "日常考评";
    public final static String RCKP_LCMC2 = "日常考评-";

    public final static String RCKP_HJMC_JBRSH = "经办人审核";
    public final static String RCKP_HJMC_KSFH = "科室复核";
    public final static String RCKP_HJMC_FGLDSP = "分管领导审批";

    public final static String RCKP_HJMC_END = RCKP_HJMC_KSFH; // 结束结点

    /*******************************************[ 日常考评-互评 ]*******************************/
    public final static String RCKPHP_LCMC = "日常考评互评";

    public final static String RCKPHP_HJMC_JBRSH = "检查员互评";
    public final static String RCKPHP_HJMC_END = RCKPHP_HJMC_JBRSH; // 结束结点

    /*******************************************[ 年度考评考评 ]*******************************/
    public final static String NDKP_LCMC = "年度考评";

    public final static String NDKP_HJMC_GRZJ = "个人总结";
    public final static String NDKP_HJMC_KPSH = "考评审核";
    public final static String NDKP_HJMC_KPFH = "考评复核";
    public final static String NDKP_HJMC_KPSP = "考评审批";

    public final static String NDKP_HJMC_END = NDKP_HJMC_KPSH; // 结束结点

    /******************[ 检查员遴选-检查员审批流程 (检查员聘任-检查员审批流程) ] *******************/

    // 流程类型
    public final static String JCYLX_LCLX_LXBMSH = "遴选报名审核";
    public final static String JCYLX_LCLX_LXQRMD = "遴选确认名单";

    public final static String JCYPR_LCLX_NPMD = "聘任拟聘名单";
    public final static String JCYPR_LCLX_QRMD = "聘任确认名单";

    public final static String JCYPR_LCLX_JPMDQR = "解聘名单确认";

    public final static String SQSX_LCLX_THZWFW= "退回政务服务";

    /*******************************************[ 质量体系文件-环节名称 ]*******************************/

    /** 质量体系文件 */
    public static final String ZLTXWJ_FLOW_CODE = "zltxwj001";
    public final static String ZLTXWJ_LCMC = "质量体系文件";

    public final static String ZLTXWJ_HJMC_SQ = "申请";
    public final static String ZLTXWJ_HJMC_KSFH = "科室复核";
    public final static String ZLTXWJ_HJMC_FGLD = "分管领导";
    public final static String ZLTXWJ_HJMC_GLZDB = "质量负责人";
    public final static String ZLTXWJ_HJMC_ZXLD = "中心领导";
    public final static String ZLTXWJ_HJMC_XDQR = "修订确认"; // 该环节废弃
    public final static String ZLTXWJ_HJMC_XDSH = "修订审核";
    public final static String ZLTXWJ_HJMC_SH_BAK = "审核";
    public final static String ZLTXWJ_HJMC_XGXGPJ = "宣贯效果评价";
    public final static String ZLTXWJ_HJMC_SSFB = "实施发布";

    /** 宣贯培训：申请-科室复核-宣贯学习-宣贯效果评价-文件实施 */
    public final static String ZLTXWJ_HJMC_WJSS = "文件实施";
    public final static String ZLTXWJ_HJMC_XGPX_END = ZLTXWJ_HJMC_WJSS; // 结束结点

    public final static String ZLTXWJ_HJMC_XGXX = "宣贯学习"; // 修订审核-延申的子流程-宣贯学习-传阅环节

    public final static String ZLTXWJ_HJMC_END = ZLTXWJ_HJMC_SSFB; // 结束结点

    public final static String DEFAULT_XGXX_OPINION_WXX = "未学习"; // 宣贯学习-默认意见
    public final static String DEFAULT_XGXX_OPINION_YXX = "已学习"; // 宣贯学习-默认意见
    public final static String FILE_TYPE_XGQKFJ = "宣贯情况附件"; // 文件类型-宣贯情况附件

    /** 不发送短信结点 */
    public final static String NOT_SEND_FLOW_SMS_HJMC_LIST =
            HJMC_JBRYZTX+ "@"
                    + THZW_HJMC_END + "@"
                    + HJMC_YSQR + "@"
                    + NDKP_HJMC_END + "@"
                    + RCKPHP_HJMC_END + "@"
                    + RCKP_HJMC_END + "@"
                    + YBKP_HJMC_END;

    /**
     * 验证该流程编码是否为审评查验流程
     * @param lcmbCode
     * @return
     */
    public static boolean verifyIsSpcyFlow(String lcmbCode){

        if (lcmbCode.equals(YPZC_FLOW_CODE_ZWFW)) {
            //  药品注册- 流程
            return true;
        } else if (lcmbCode.equals(YPSC_FLOW_CODE_ZWFW)){
            // 药品生产
            return true;
        }else if (lcmbCode.equals(YPLT_FLOW_CODE_ZWFW)){
            // 药品流通
            return true;
        }else if (lcmbCode.equals(YLQX_FLOW_CODE_ZWFW)){
            // 医疗器械
            return true;
        }else if (lcmbCode.equals(HZP_FLOW_CODE_ZWFW)){
            // 化妆品
            return true;
        }else {
            return false;
        }
    }

    /**
     * 根据业务分类编码-获取对应的流程模板编码
     * @param ywflcode 业务分类编码
     * @param xzspzt 行政审批状态
     */
    public static String getFlowCodeByYwflcode(String ywflcode, String xzspzt){
        if (StringUtils.isBlank(ywflcode)){
            return YPSC_FLOW_CODE_ZWFW;
        }

        return YPSC_FLOW_CODE_ZWFW;

        /** 注释 */
        /*if (ywflcode.equals(SpcyConstant.YWFL_CODE_YPZC)){
            if (StringUtils.isBlank(xzspzt) || xzspzt.equals(SpcyConstant.SQSX_BASIC_XZSPZT_RCJG)){
                return YPZC_FLOW_CODE_RCJG;
            }else if (xzspzt.equals(SpcyConstant.SQSX_BASIC_XZSPZT_YES)) {
                return YPZC_FLOW_CODE_ZWFW;
            }
        }

        if (ywflcode.equals(SpcyConstant.YWFL_CODE_YPSC)){
            if (StringUtils.isBlank(xzspzt) || xzspzt.equals(SpcyConstant.SQSX_BASIC_XZSPZT_RCJG)){
                return YPSC_FLOW_CODE_RCJG;
            }else if (xzspzt.equals(SpcyConstant.SQSX_BASIC_XZSPZT_YES)) {
                return YPSC_FLOW_CODE_ZWFW;
            }
        }

        if (ywflcode.equals(SpcyConstant.YWFL_CODE_YPJY)){
            if (StringUtils.isBlank(xzspzt) || xzspzt.equals(SpcyConstant.SQSX_BASIC_XZSPZT_RCJG)){
                return YPLT_FLOW_CODE_RCJG;
            }else if (xzspzt.equals(SpcyConstant.SQSX_BASIC_XZSPZT_YES)) {
                return YPLT_FLOW_CODE_ZWFW;
            }
        }

        if (ywflcode.equals(SpcyConstant.YWFL_CODE_YLQX)){
            if (StringUtils.isBlank(xzspzt) || xzspzt.equals(SpcyConstant.SQSX_BASIC_XZSPZT_RCJG)){
                return YLQX_FLOW_CODE_RCJG;
            }else if (xzspzt.equals(SpcyConstant.SQSX_BASIC_XZSPZT_YES)) {
                return YLQX_FLOW_CODE_ZWFW;
            }
        }

        if (ywflcode.equals(SpcyConstant.YWFL_CODE_HZP)){
            if (StringUtils.isBlank(xzspzt) || xzspzt.equals(SpcyConstant.SQSX_BASIC_XZSPZT_RCJG)){
                return HZP_FLOW_CODE_RCJG;
            }else if (xzspzt.equals(SpcyConstant.SQSX_BASIC_XZSPZT_YES)) {
                return HZP_FLOW_CODE_ZWFW;
            }
        }*/

//        return "";
    }

}
